﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class XTJDiceAnima : MonoBehaviour {

    public UISprite spritAni;
    public int count;
    public float speed;
    private void Start()
    {
        StartCoroutine(DoAnimation());
    }

    void OnEnable()
    {
       
    }

    IEnumerator DoAnimation()
    {
        for (int i = 1; i <= count; i++)
        {
            spritAni.spriteName = "shaizi_anmi" + i.ToString();
            //spritAni.width = spritAni.GetAtlasSprite().width;
            //spritAni.height = spritAni.GetAtlasSprite().height;
            yield return new WaitForSeconds(speed);
            if (i == count)
            {
                i = 0;
            }

        }
    }
}
